package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

public class ReflectDemo11 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class cls=Class.forName("reflect.Person");
        Method method=cls.getMethod ("sayHi");
        if (method.isAnnotationPresent(AutoRunMethod.class)){
            AutoRunMethod ar=method.getAnnotation(AutoRunMethod.class);
            int value=ar.value();
            System.out.println(value);
        }else {
            System.out.println(method.getName()+"没有被注解");
        }
    }
}
